package java1;

import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Fivesix {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Queue<Integer> A = new LinkedList<Integer>();
		Queue<Integer> B = new LinkedList<Integer>();
		Queue<Integer> C = new LinkedList<Integer>();
		int N = sc.nextInt();
		for (int i = 0; i < N; i++) {
			int x = sc.nextInt();
			if (x % 2 == 1) {
				A.offer(x);
			} else {
				B.offer(x);
			}
		}
		while (!A.isEmpty() || !B.isEmpty()) {
			if(!A.isEmpty()) C.offer(A.poll());
			if(!A.isEmpty()) C.offer(A.poll());
			if(!B.isEmpty()) C.offer(B.poll());
		}
		System.out.print(C.poll());
		for (int i = 0; i < N - 1; i++) {
			System.out.print(" " + C.poll());
		}
	}

}
